import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
import { h } from 'vue';
import { Tag } from 'ant-design-vue';


//列表数据
export const columns: BasicColumn[] = [
  {
    title: '统一社会信用代码',
    align:"center",
    dataIndex: 'customerNumber'
  },
  {
    title: '客户',
    align:"center",
    dataIndex: 'customerName'
  },
  {
    title: '注册资本(万元)',
    align:"center",
    dataIndex: 'registeredCapital',
    width: 140,
    customRender: ({ text }) => (text ? `${text} 万元` : ''),
  },
  {
    title: '行业',
    align:"center",
    dataIndex: 'industry',
    width: 100
  },
  {
    title: '经营范围',
    align:"center",
    dataIndex: 'businessScope',
    width: 150,
    ellipsis: true
  },
  {
    title: '引流人真实姓名',
    align:"center",
    dataIndex: 'createBy'
  },
  {
    title: '客户来源渠道',
    align:"center",
    dataIndex: 'sourceChannel_dictText'
  },
  {
    title: '分配状态',
    align:"center",
    dataIndex: 'status_dictText',
    customRender: ({ text }) => {
      if (text === '未分配') {
        return h(Tag, { color: 'orange' }, () => text);
      } else if (text === '已分配') {
        return h(Tag, { color: 'green' }, () => text);
      }
      return text;
    },
  },
  {
    title: '需求升级来源客户编号',
    align:"center",
    dataIndex: 'parentCustomerId',
    defaultHidden: true,
    customRender: ({ text }) => {
      return text || '-';
    },
  },
  {
    title: '引流时间',
    align:"center",
    dataIndex: 'createTime'
  },
];

//子表列表数据
export const contactsColumns: BasicColumn[] = [
  {
    title: '联系人姓名',
    align:"center",
    dataIndex: 'contactName'
  },
  {
    title: '联系人电话',
    align:"center",
    dataIndex: 'phone'
  },
  {
    title: '联系人微信',
    align:"center",
    dataIndex: 'chat'
  },
  {
    title: '联系人邮箱',
    align:"center",
    dataIndex: 'email'
  },
  {
    title: '创建日期',
    align:"center",
    dataIndex: 'createTime',
    defaultHidden: true
  },
];



// 高级查询数据
export const superQuerySchema = {
  customerNumber: {title: '统一社会信用代码',order: 0,view: 'text', type: 'string',},
  customerName: {title: '客户公司名',order: 1,view: 'text', type: 'string',},
  createBy: {title: '引流人真实姓名',order: 2,view: 'text', type: 'string',},
  sourceChannel: {title: '客户来源渠道',order: 3,view: 'list', type: 'string',dictCode: 'come_channel',},
  status: {title: '分配状态',order: 4,view: 'number', type: 'number',dictCode: 'customer_status',},
  registeredCapital: {title: '注册资本',order: 6,view: 'text', type: 'string',},
  industry: {title: '行业',order: 7,view: 'text', type: 'string',},
  businessScope: {title: '经营范围',order: 8,view: 'text', type: 'string',},
  parentCustomerId: {title: '需求升级来源客户编号',order: 9,view: 'text', type: 'string',},
  createTime: {title: '创建时间',order: 10,view: 'date', type: 'string',},
};
